package com.wlc.base.design.strategymode.v2_1;

/**
 * @author 王立朝
 * @date 2022/3/16
 * @description:
 */
public class CashContext {

    CashSuper cashSuper;
    CashSuper cs = null;
    public CashContext(String type){

        switch (type) {
            case "正常收费":
                CashNormal cs0 = new CashNormal();
                cs = cs0;
                break;
            case "满300 返100":
                CashReturn cs2 = new CashReturn(500.0,200.0);
                cs = cs2;
                break;
            case "打八折":
                CashRebate cs3= new CashRebate("0.8");
                cs = cs3;
                break;
        }
    }

    public double getResult(double money){
        return cs.acceptCash(money);

    }
}
